<template>
  <div>
    <div class="title">热销推荐</div>
    <ul>
        <router-link :to="'/detail/' + item.id" tag="li" v-for="(item, index) in list" :key="index" class="item">
          <div class="item-image-swapper">
            <img :src="item.imgUrl" class="item-img" />
          </div>
          <div class="item-info">
            <div class="item-title">{{ item.title }}</div>
            <div class="item-desc">{{ item.desc }}</div>
            <div class="item-price">
              <span class="symbol">￥</span>
              <span class="price">{{ item.price }}</span>
              起
            </div>
          </div>
      </router-link>
    </ul>
  </div>
</template>

<script>
export default {
  name: "HomeRecommend",
  props: {
    list: Array,
  },
  data() {
    return {};
  },
};
</script>

<style scoped>
.single-line-omission {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.title {
  margin-top: 0.2rem;
  line-height: 0.8rem;
  background: #eee;
  text-indent: 0.2rem;
}

.item {
  width: 100%;
  height: 100px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
  border-bottom: 1px solid #f0f0f0;
}

.item-img {
  width: 70px;
  height: 70px;
  border-radius: 10px;
}

.item-info {
  width: 100%;
  height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-wrap: nowrap;
  margin-left: 10px;
  color: #666666;
}

.item-title {
  font-weight: bold;
  color: #333333;
}

.item-title,
.item-desc,
.item-price {
  max-width: calc(100% - 80px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.symbol,
.price {
  color: #ff7400;
}

.price {
  margin-right: 4px;
  font-size: 18px;
}
</style>